package net.toocruel.iqismart.entity.core;

import net.toocruel.iqismart.entity.base.BaseEntity;
import net.toocruel.iqismart.entity.common.Tag;
import net.toocruel.iqismart.entity.constants.SourceType;
import net.toocruel.iqismart.entity.rbac.User;

import javax.persistence.*;

/**
 * @Description
 * @Auther sty
 * @createTime 2018/5/8 上午11:35
 */
@Entity
public class Attention extends BaseEntity {
    private static final long serialVersionUID = -8596929240863980538L;
    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY,optional = false)
    @JoinColumn(name = "userId")
    private User user;
    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "questionId")
    private Question question;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "answerId")
    private Answer answer;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "articleId")
    private Article article;

    @ManyToOne(cascade = CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "tagId")
    private Tag tag;

    @Enumerated(EnumType.ORDINAL)
    private SourceType sourceType;


    public Question getQuestion() {
        return question;
    }

    public void setQuestion(Question question) {
        this.question = question;
    }

    public Answer getAnswer() {
        return answer;
    }

    public void setAnswer(Answer answer) {
        this.answer = answer;
    }

    public Article getArticle() {
        return article;
    }

    public void setArticle(Article article) {
        this.article = article;
    }

    public void setSourceType(SourceType sourceType) {
        this.sourceType = sourceType;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public SourceType getSourceType() {
        return sourceType;
    }

    public Tag getTag() {
        return tag;
    }

    public void setTag(Tag tag) {
        this.tag = tag;
    }
}
